package com.woniuxy.secondkill.configuration;

import org.redisson.Redisson;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RedissonConfiguration {
    @Bean
    public Redisson redisson(){
        //1创建配置类对象
        Config config = new Config();
        //2设置工作模式、redis的地址等信息
        config.useSingleServer().setAddress("redis://127.0.0.1:6379").setDatabase(0);
        //3创建redisson对象
        Redisson redisson = (Redisson) Redisson.create(config);

        return redisson;
    }

}
